package com.uplooking.controller;

import com.uplooking.service.DeleteArtical;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;

@WebServlet(name = "DeleteArticalServlet")
public class DeleteArticalController extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("application/json;charset=utf8");
        Integer id = Integer.valueOf(request.getParameter("id"));
        DeleteArtical deleteArtical = new DeleteArtical();
        try {
            Integer deleteArtical1 = deleteArtical.getDeleteArtical(id);
            response.getWriter().print(0);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
